<?php

namespace App\Commons\Validators;

class VerifycodeValidator
{
    private static $_value;

    public function validate($attribute, $value, $parameters, $validator): bool
    {
        static::$_value = $value;

        return preg_match("/^\d{6}$/", $value);
        ;
    }

    public function replacer($message, $attribute, $rule, $parameters, $validator): string
    {
        return str_replace(':verifycode', static::$_value, $message);
    }
}
